<template>
<nav>
    <home-header ></home-header>
    <home-swiper  :List="swiperList"></home-swiper>
    <home-icons  :list="iconList"></home-icons>
    <home-recommend :List="recommendList"></home-recommend>
    <home-weekend :list="weekendList"></home-weekend>
</nav>
</template>

<script>
import HomeHeader from './components/Header.vue'
import HomeSwiper from './components/Swiper.vue'
import HomeIcons from './components/Icons.vue'
import HomeRecommend from './components/Recommend.vue'
import HomeWeekend from './components/Weekend.vue'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },data () {
    return {
      swiperList:[],
      recommendList:[],
      iconList:[],
      weekendList:[]
    }
  },
  methods:{
    getHomeInfo(){
      axios.get('/api/index.json').then(this.getHomeInfoSucc);
    },
    getHomeInfoSucc(res){
    if(res.data.ret && res.data.data){

        this.swiperList = res.data.data.swiperList;
        this.recommendList = res.data.data.recommendList;
        this.iconList = res.data.data.iconList;
        this.weekendList = res.data.data.weekendList;
      }
    
    }
  },
  mounted () {
    this.getHomeInfo();
  }
}
</script>

<style></style>
